﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 用户信息
    /// </summary>
    public class UserInfo
    {
        public string UserID { get; set; }
        public string UserName { get; set; }
        public string Name { get; set; }
        public bool Gender { get; set; }
        public string GenderString { get; set; }
        public string Password { get; set; }
        public string Email { get; set; }
        public virtual ClassInfo ClassInfo { get; set; }
        public byte[] Photo { get; set; }
        public virtual RoleInfo RoleInfo { get; set; }
        public string URL { get; set; }
        public UserInfo() { }
        public UserInfo(string userId, string userName, string name, string password, string email, int classId, int roleId, byte[] photo = null, string url = null)
        {
            this.UserID = userId;
            this.UserName = userName;
            this.Name = name;
            this.Password = password;
            this.Email = email;
            this.ClassInfo.ClassID = classId;
            this.RoleInfo.RoleID = roleId;
            if (photo != null)
            {
                this.Photo = photo;
            }
            if (url != null)
            {
                this.URL = url;
            }
        }
        public UserInfo(string gender)
        {
            if (gender == "女")
            {
                this.Gender = false;
            }
            else
            {
                this.Gender = true;
            }
        }
        public UserInfo(bool gender)
        {
            if (gender)
            {
                this.GenderString = "男";
            }
            else
            {
                this.GenderString = "女";
            }
        }
    }
}
